{{!
  Displays the results of an Algolia search in a rows format.

  <RowResults /> properties:
    @docs: Algolia result's "hits" element from a docs search response.
    @isDraft: Document is a draft.
    @nbPages: Algolia result's "nbPages" element from a docs search response.
    @page: Algolia result's "page" element from a docs search response.
}}

<section>
  <div class="x-container">
    <div class="row-results">
      {{#if @docs}}
        <Hds::Table @isStriped={{false}} class="row-results__table">
          <:head as |H|>
            <H.Tr>
              <H.Th class="name">Name</H.Th>
              <H.Th class="type">Type</H.Th>
              <H.Th class="status">Status</H.Th>
              <H.Th class="product">Product/Area</H.Th>
              <H.Th class="owner">Owner</H.Th>
              <H.Th class="created">Created</H.Th>
            </H.Tr>
          </:head>
          <:body>
            {{#each @docs as |doc index|}}
              <Doc::Row
                @avatar="{{get doc.ownerPhotos 0}}"
                @createdDate="{{parse-date doc.created}}"
                @docID="{{doc.objectID}}"
                @docNumber="{{doc.docNumber}}"
                @docType="{{doc.docType}}"
                @owner="{{get doc.owners 0}}"
                @productArea="{{doc.product}}"
                @status="{{lowercase doc.status}}"
                @title="{{doc.title}}"
                @isDraft={{@isDraft}}
              />
            {{/each}}
          </:body>
        </Hds::Table>
        <Pagination @nbPages={{@nbPages}} @currentPage={{@currentPage}} />
      {{else}}
        {{#if @isDraft}}
          <Hds::Alert @type="inline" as |A|>
            <A.Title>No drafts found</A.Title>
            <A.Button
              @text="Create a document draft"
              @color="primary"
              @icon="file-plus"
              @route="authenticated.new"
            />
          </Hds::Alert>
        {{/if}}
      {{/if}}
    </div>
  </div>
</section>
